<template>
  <el-dialog
  title="题目审核"
  :visible="dialogVisible"
  width="30%"
  @close="close"
  >
   <el-radio v-model="radio" label="1">通过</el-radio>
  <el-radio v-model="radio" label="2">拒绝</el-radio>
<el-form :rules="rules" style="margin-right:40px;margin-top: 40px;" ref="ruleform" :model="formData" label-width="80px">
    <el-form-item prop="chkRemarks">
    <el-input type="textarea" placeholder="请输入审核意见" v-model="formData.chkRemarks"></el-input>
  </el-form-item>
  </el-form>
  <span slot="footer" class="dialog-footer" style="display:flex;justify-content:flex-end" >
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="submit">确 定</el-button>
  </span>
</el-dialog>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  name: 'questionsCheck',
  data () {
    return {
      dialogVisible: false,
      radio: '1',
      form: {},
      formData: {
        chkRemarks: ''
      },
      rules: {
        chkRemarks: [
          { required: true, message: '请选择活动区域', trigger: 'blur' }
        ]
      }
    }
  },
  props: {
    id: {
      required: true,
      type: [Number, String]
    }
  },
  methods: {
    close () {
      this.dialogVisible = false
      this.$refs.ruleform.resetFields()
    },
    openDialog () {
      this.dialogVisible = true
    },
    submit () {
      this.$refs.ruleform.validate(async (value) => {
        if (value) {
          await choiceCheck({ id: this.id, chkRemarks: this.formData.chkRemarks, chkState: +this.radio })
          this.$emit('shuaxin')
          this.close()
        }
      })
    }
  }
}
</script>

<style scoped lang='less'></style>
